import React from "react";
import {Tag} from "antd";
type TagKey = "GET" | "PUT" | "DELETE" | "POST" | "ANY" ;
const tagMap = new Map<TagKey, React.ReactNode>();

tagMap.set("GET", <Tag color={"#2d4917"}>GET</Tag>);
tagMap.set("PUT", <Tag color={"#294c93"}>PUT</Tag>);
tagMap.set("POST", <Tag color={"#45c82c"}>POST</Tag>);
tagMap.set("DELETE", <Tag color={"#650a0a"}>DELETE</Tag>);
tagMap.set("ANY", <Tag color={"#7e36a1"}>ANY</Tag>);


const getMethodTag = (value: TagKey | string) => {
    switch (value){
        case "ANY":
            return <Tag color={"#914747"}>{value}</Tag>;
        case "GET":
            return <Tag color={"#20351b"}>{value}</Tag>;
        case "POST":
            return <Tag color={"#204e53"}>{value}</Tag>;
        case "PUT":
            return <Tag color={"#7f478f"}>{value}</Tag>;
        case "DELETE":
            return <Tag color={"#c61c1c"}>{value}</Tag>;
        default:
            return <Tag color={"#615555"}>{value}</Tag>;
    }
};

export {tagMap, getMethodTag};